From: Keir Fraser Date: Mon, 29 Sep 2008 08:43:05 +0000 (+0100) Subject: domctl: Fix the wrong return values when xsm_xxx() returns 0 X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14101^2~10 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=4b2d30ac85a069609c53df939b2289d200997cfb;p=xen.git domctl: Fix the wrong return values when xsm_xxx() returns 0 In 18423: 44f039c4aee4, if xsm_xxx() returns 0, there are some places where the return value would be incorrect. The patch fixes them. Signed-off-by: Dexuan Cui --- diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index e2672e4794..abbaa7f8a3 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -620,14 +620,14 @@ long arch_do_domctl( if ( !iommu_enabled ) break; - ret = -EINVAL; - bus = (domctl->u.assign_device.machine_bdf >> 16) & 0xff; - devfn = (domctl->u.assign_device.machine_bdf >> 8) & 0xff; - ret = xsm_test_assign_device(domctl->u.assign_device.machine_bdf); if ( ret ) break; + ret = -EINVAL; + bus = (domctl->u.assign_device.machine_bdf >> 16) & 0xff; + devfn = (domctl->u.assign_device.machine_bdf >> 8) & 0xff; + if ( device_assigned(bus, devfn) ) { gdprintk(XENLOG_ERR, "XEN_DOMCTL_test_assign_device: " @@ -670,6 +670,7 @@ long arch_do_domctl( break; } + ret = -EINVAL; if ( device_assigned(bus, devfn) ) { gdprintk(XENLOG_ERR, "XEN_DOMCTL_assign_device: " @@ -751,6 +752,7 @@ long arch_do_domctl( if ( ret ) goto bind_out; + ret = -ESRCH; if ( iommu_enabled ) ret = pt_irq_create_bind_vtd(d, bind); if ( ret < 0 )